<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>xmake</title>
  <link rel="icon" href="/assets/img/favicon.ico">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="description" content="Description">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <link href="//cdn.jsdelivr.net/npm/github-markdown-css@4.0.0/github-markdown.min.css" rel="stylesheet">
  <style>
	.markdown-body {
		box-sizing: border-box;
		min-width: 200px;
		max-width: 980px;
		margin: 0 auto;
		padding: 45px;
	}

	@media (max-width: 767px) {
		.markdown-body {
			padding: 15px;
		}
	}
  </style>
</head>
<body>
<article class="markdown-body">
<h4>This is a mirror page, please see the original page: </h4><a href="https://xmake.io/#/zh-cn/manual/option_instance">https://xmake.io/#/zh-cn/manual/option_instance</a>
</br>
    <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve=CE7I52QU&placement=xmakeio" id="_carbonads_js"></script>
<style>
#carbonads {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
  Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

#carbonads {
  display: flex;
  max-width: 330px;
  background-color: hsl(0, 0%, 98%);
  box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, .1);
}

#carbonads a {
  color: inherit;
  text-decoration: none;
}

#carbonads a:hover {
  color: inherit;
}

#carbonads span {
  position: relative;
  display: block;
  overflow: hidden;
}

#carbonads .carbon-wrap {
  display: flex;
}

.carbon-img {
  display: block;
  margin: 0;
  line-height: 1;
}

.carbon-img img {
  display: block;
}

.carbon-text {
  font-size: 13px;
  padding: 10px;
  line-height: 1.5;
  text-align: left;
}

.carbon-poweredby {
  display: block;
  padding: 8px 10px;
  background: repeating-linear-gradient(-45deg, transparent, transparent 5px, hsla(0, 0%, 0%, .025) 5px, hsla(0, 0%, 0%, .025) 10px) hsla(203, 11%, 95%, .4);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
  font-size: 9px;
  line-height: 1;
}
</style>
    <p>此页面描述了 <a href="zh-cn/manual/configuration_option.md">配置选项</a> 的 <code>on_load()</code>、<code>on_check()</code> 或 <code>after_check()</code> 等函数的 <code>option</code> 接口</p>
<h4 id="optionname">option:name</h4>
<ul>
<li>获取选项的名字</li>
</ul>
<h4 id="optionget">option:get</h4>
<ul>
<li>获取选项在描述域的配置值</li>
</ul>
<p>任何在描述域的 <code>set_xxx</code> 和 <code>add_xxx</code> 配置值都可以通过这个接口获取到。</p>
<pre><code class="lang-lua">-- get the links
option:get("links")
-- get the defined macros
option:get("defines")
</code></pre>
<h4 id="optionset">option:set</h4>
<ul>
<li>设置选项的配置值，（如果你想添加值可以用 <a href="#optionadd">option:add</a>）。</li>
</ul>
<pre><code class="lang-lua">-- set the links
option:set("links", "sdl2")
-- set the defined macros
option:set("defines", "SDL_MAIN_HANDLED")
</code></pre>
<h4 id="optionadd">option:add</h4>
<ul>
<li>按名称添加到选项的值</li>
</ul>
<pre><code class="lang-lua">-- add links
option:add("links", "sdl2")
-- add defined macros
option:add("defines", "SDL_MAIN_HANDLED")
</code></pre>
<p>!> 此处文档还在进行中，请耐心等待，你也可以通过赞助或者提 pr 来加速文档的更新</p>
</article>
</body>
</html>